import request from '@/utils/request'

//消息收藏列表
export const queryMessageCollectList = (params) => {
  return request('GET', '/app/messageCollect/list', params)
}

//消息收藏新增
export const queryMessageCollectAdd = (params) => {
  return request('POST', '/app/messageCollect', params)
}
//修改消息收藏
export const queryMessageCollectUpdate = (params) => {
  return request('PUT', '/app/messageCollect', params)
}
//删除消息收藏
export const queryMessageCollectDelete = (id) => {
  return request('delete', `/app/messageCollect/${id}`)
}
//清除消息
export const messageClean = (params) => {
  return request('POST', '/app/messageClean/clean', params)
}

//设置消息免打扰
export const setMute = (params) => {
  return request('POST', '/app/mute/mute', params)
}
//获取消息免打扰
export const getMute = (params) => {
  return request('GET', '/app/mute/mute', params)
}

let isUpload = {
	list: ''
}

// 自定义chatGPT
export const getChatGPT = (params) => {
  if(isUpload.list) {
    isUpload.list.abort()
  }
  return request('POST', '/chat/chat', params, true, false, "加载中", "application/json", true, isUpload, 300000)
}

// 停止联想
export const stopChatFPT = () => {
  if(isUpload.list) {
    isUpload.list.abort()
  }
}

// 清空 ChatGPT 联想缓存
export const clearChatGpt = () => {
  if(isUpload.list) {
    isUpload.list.abort()
  }
  return request('POST', '/chat/removeCache')
}